package com.phone580.app.download;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.TabHost.TabSpec;

import com.phone580.app.R;

public class DownloadManagerActivity extends TabActivity implements OnClickListener{
	
	private TabHost tabHost;
	private LayoutInflater inflater;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.download_manager_layout);
		inflater = (LayoutInflater) this.getLayoutInflater();
		initHeader("下载管理");
		tabHost = getTabHost();
		TabSpec tabSpec1 = tabHost.newTabSpec("unfinish");
		tabSpec1.setIndicator(getTabView("正在下载"));
		tabSpec1.setContent(new Intent(this, UnFinishDownloadActivity.class));
		tabHost.addTab(tabSpec1);
		
		TabSpec tabSpec2 = tabHost.newTabSpec("finish");
		tabSpec2.setIndicator(getTabView("下载完成"));
		tabSpec2.setContent(new Intent(this, FinishDownloadActivity.class));
		tabHost.addTab(tabSpec2);
		
	}
	
	protected void initHeader (String title) {
		final TextView tvTitle = (TextView) findViewById(R.id.download_manager_header_title_tv);
		tvTitle.setText(title);
	}
	
	private View getTabView (String title) {
		View view = inflater.inflate(R.layout.download_manager_tab_item, null);
		TextView tvTitle = (TextView) view.findViewById(R.id.download_manager_tab_item_title);
		tvTitle.setText(title);
		return view;
	}

	@Override
	public void onClick(View v) {
		
	}
	
	@Override
	protected void onDestroy() {
		super.onDestroy();
	}
}
